package oop.core.view;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;

import oop.core.item.Equipment;
import oop.core.item.EquippableItem;
import oop.core.item.EquippableItemPosition;
import oop.core.item.Inventory;
import oop.core.item.TakeableItem;
import oop.core.item.UsableItem;

/**
 * InventoryPanel is the panel that displays the inventory and
 * items currently in it.
 *
 */
public class InventoryPanel extends SizeablePanel {

	private static final Dimension SIZE = new Dimension(400, 200);
	private static final Point LOCATION = new Point(600, 400);
	
	private Inventory inventory;
	
	public InventoryPanel()
	{
		super(LOCATION, SIZE);
	}
	
	public void takeInventory(Inventory inventory)
	{
		this.inventory = inventory;
	}
	
	/**
	 * Renders the inventory.
	 */
	protected void paintComponent(Graphics g)
	{
//		System.out.println("Painting InventoryPanel");
		g.setColor(Color.GREEN);
		g.fillRect(0, 0, SIZE.width, SIZE.height);
        
        for(int k=0; k<10; k++)
        {
                TakeableItem item = inventory.getItem(k);
                if(item == null)
                        continue;
                
                int x = 10 + (k%5)*50;
                int y = 10 + (k/5)*50;
                g.drawImage(ImageHandler.getImage(item.getImageID()), x, y, null);
        }
	}
}
